home *** CD-ROM | disk | FTP | other *** search
- #include "EXTERN.h"
- #include "perl.h"
-
- int link()
- {
- if (dowarn)
- warn("MacPerl: link always fails");
-
- return -1;
- }
-
- unsigned short umask(unsigned short arg)
- {
- if (dowarn && arg)
- warn("MacPerl: nonzero argument to umask() ignored");
-
- return 0;
- }
-
- static char *
- setup_argstr(SV *really, SV **mark, SV **sp)
- {
- char *junk, *tmps = Nullch;
- register size_t cmdlen = 0;
- size_t rlen;
- register SV **idx;
-
- idx = mark;
- if (really) {
- tmps = SvPV(really,rlen);
- if (*tmps) {
- cmdlen += rlen + 1;
- idx++;
- }
- }
-
- for (idx++; idx <= sp; idx++) {
- if (*idx) {
- junk = SvPVx(*idx,rlen);
- cmdlen += rlen ? rlen + 1 : 0;
- }
- }
- New(401,Cmd,cmdlen,char);
-
- if (tmps && *tmps) {
- strcpy(Cmd,tmps);
- mark++;
- }
- else *Cmd = '\0';
- while (++mark <= sp) {
- if (*mark) {
- strcat(Cmd," ");
- strcat(Cmd,SvPVx(*mark,na));
- }
- }
- return Cmd;
- } /* end of setup_argstr() */
-
- int do_spawn(char * command)
- {
- int ch;
- FILE * temp = my_popen(command, "r");
-
- while ((ch = getc(temp)) != EOF)
- putc(ch, stdout);
-
- my_pclose(temp);
- }
-
- int do_aspawn(SV *really,SV **mark,SV **sp)
- {
- if (sp > mark) {
- return do_spawn(setup_argstr(really,mark,sp));
- }
-
- return -1;
- } /* end of do_aspawn() */
-
- char * sys_errlist[] = {
- "No error",
- "Operation not permitted",
- "No such file or directory",
- "No such process",
- "Interrupted system call",
- "Input/output error",
- "Device not configured",
- "Argument list too long",
- "Exec format error",
- "Bad file descriptor",
- "No child processes",
- "Operation would block",
- "Cannot allocate memory",
- "Permission denied",
- "Bad address",
- "Block device required",
- "Device busy",
- "File exists",
- "Cross-device link",
- "Operation not supported by device",
- "Not a directory",
- "Is a directory",
- "Invalid argument",
- "Too many open files in system",
- "Too many open files",
- "Inappropriate ioctl for device",
- "Text file busy",
- "File too large",
- "No space left on device",
- "Illegal seek",
- "Read-only file system",
- "Too many links",
- "Broken pipe",
- "Numerical argument out of domain",
- "Result too large",
- "(unknown)",
- "Operation now in progress",
- "Operation already in progress",
- "Socket operation on non-socket",
- "Destination address required",
- "Message too long",
- "Protocol wrong type for socket",
- "Protocol not available",
- "Protocol not supported",
- "Socket type not supported",
- "Operation not supported on socket",
- "Protocol family not supported",
- "Address family not supported by protocol family",
- "Address already in use",
- "Can't assign requested address",
- "Network is down",
- "Network is unreachable",
- "Network dropped connection on reset",
- "Software caused connection abort",
- "Connection reset by peer",
- "No buffer space available",
- "Socket is already connected",
- "Socket is not connected",
- "Can't send after socket shutdown",
- "Too many references: can't splice",
- "Connection timed out",
- "Connection refused",
- "Too many levels of symbolic links",
- "File name too long",
- "Host is down",
- "No route to host",
- "Directory not empty",
- "Too many processes",
- "Too many users",
- "Disc quota exceeded",
- "Stale NFS file handle",
- "Too many levels of remote in path",
- "RPC struct is bad",
- "RPC version wrong",
- "RPC prog. not avail",
- "Program version wrong",
- "Bad procedure for program",
- "No locks available",
- "Function not implemented",
- "Inappropriate file type or format",
- 0
- };
-